<?php 
HeaderScripts::addJsLibrary(array(
	'jquery/jquery-ui-1.7.2.min.js',
	'jquery/jquery-ui-spinner.js',
	'jquery/jquery.form.js',
	'jquery/jquery.qtip.js',
	'jquery/jqgrid/i18n/grid.locale-ru.js',
	'jquery/jqgrid/jquery.jqGrid.min.js'
));
HeaderScripts::addScripts(array(
	'site/search.js'
));
HeaderScripts::addStyles(array(
	'site/jquery.ui/jquery-ui-1.7.2.custom.css',
	'site/jqgrid.css'
));
?>
<script type="text/javascript">
$(document).ready(function() {
	var monthNames  = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'];
	var dayNames    = ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'];
	var dayNamesMin = ['Вск', 'Пнд', 'Вт', 'Ср', 'Чтв', 'Птн', 'Суб'];

	var datepickerSettings = {
		showOn: 'button',
		buttonImage: '/public/css/images/calendar.gif',
		buttonImageOnly: true,
		dayNames: dayNames,
		dayNamesMin: dayNamesMin,
		monthNames: monthNames,
		dateFormat: 'dd-mm-yy'
	}
	
	$("#datepicker1").datepicker(datepickerSettings);
	$("#datepicker2").datepicker(datepickerSettings);

	$("#price1").spinner({stepping: 100});
	$("#price2").spinner({stepping: 100});
});
</script>
<div class="headerBlock">
	<div class="headerTxt">Поиск</div>
</div>
<div class="scrollBlock">
	<form name="searchForm" id="searchForm" method="post" action="/hotel/advancedsearchact/" enctype="multipart/form-data">
		<table cellpadding="0" cellspacing="0" border="0" style="width: 670px;">
			<tr>
				<td>
					<table cellpadding="3" cellspacing="3" border="0">
						<tr>
							<td><span class="searchtitle">Дата заезда:</span></td><td><input type="text" value="<?php echo date('d-m-Y') ?>" id="datepicker1" name="date1"></td>
						</tr>
						<tr>
							<td><span class="searchtitle">Дата выезда:</span></td><td><input type="text" value="<?php echo date('d-m-Y', time() + 7 * 24 * 60 * 60) ?>" id="datepicker2" name="date2"></td>
						</tr>
					</table>						
				</td>
				<td>
					<table cellpadding="3" cellspacing="3" border="0">
						<tr>
							<td><span class="searchtitle">Цена от:</span></td>
							<td><input type="text" id="price1" name="price1"></td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td><span class="searchtitle">Цена до:</span></td>
							<td><input type="text" id="price2" name="price2"></td>
							<td><span class="searchtitle">Категория:</span></td>
							<td><select name="stars" id="stars">
									<option value="0">Любая</option>
									<?php $starsArr = array(1, 2, 3, 4, 5) ?>
									<?php foreach($starsArr as $star) { ?>
									<option value="<?php echo $star ?>"><?php echo $star ?>*</option>
									<?php }?>
								</select></td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr>
				<td style="padding-left: 6px;">
					<div style="padding-top: 12px; padding-bottom: 10px;"><span class="searchtitle">Город:</span></div>
					<div style="padding-bottom: 5px;"><input type="checkbox" name="anycity" id="anycity" value="1" checked="true"><span class="searchtitle"><strong>Любой</strong></span></div>
					<div class="searchscroll1">
					<?php foreach ($cities as $city) { ?>
					<input type="checkbox" name="city[]" value="<?php echo intval($city['id']) ?>"><?php echo $city['title'] ?><br />
					<?php } ?>
					</div>
				</td>
				<td>
					<div style="padding-top: 12px; padding-bottom: 10px;"><span class="searchtitle">Гостиница:</span></div>
					<div style="padding-bottom: 5px;">
						<input name="hotelsearch" id="hotelsearch" type="text" value="" style="width: 130px;">
						&nbsp;<input type="checkbox" name="anyhotel" id="anyhotel" value="1" checked="true"><span class="searchtitle"><strong>Любая</strong></span>
					</div>
					<div class="searchscroll2">
					<?php foreach ($data as $hotel) { ?>
					<span><input type="checkbox" name="hotel[]" value="<?php echo intval($hotel['id']) ?>" cityId="<?php echo intval($hotel['cityId']) ?>" stars="<?php echo intval($hotel['stars']) ?>"><span><?php echo $hotel['title'] ?></span> <?php echo $hotel['stars'] ?>*<br /></span>
					<?php } ?>
					</div>
				</td>
			</tr>
			<tr>
				<td>
				</td>
				<td>
					<div style="padding-top: 30px;" align="right">
						<div class="orderButton" id="formSearch"><div class="orderButtonTxt">Поиск</div></div>
					</div>
				</td>
			</tr>
		</table>
	</form>
</div>